import { createRouter, createWebHashHistory } from 'vue-router'
import 'nprogress/nprogress.css'
import { createRouterGuards } from './router-guards'
import modules from './modules'
import Layout from '@/layout/index.vue'

export const routes = [
  {
    path: '/',
    component: Layout
  },
  {
    path: '/home',
    component: Layout,
    name: '主页',
    meta: { title: '主页' },
    children: [
      {
        path: 'home',
        component: () => import('@/views/home/index.vue'),
        name: '主页',
        meta: { title: '主页', icon: 'https://web-img-l.oss-cn-beijing.aliyuncs.com/supply-chain/home-fill.png' }
      }
    ]
  },
  ...modules
  // { path: '/:pathMatch(.*)*', redirect: '/', hidden: true }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

createRouterGuards(router)

export default router
